Release 10.1A: OpenEdge Getting Started:
Object-oriented Programming
Instantiating and managing class-based objects
Each user-defined class essentially represents a new data type. As a group these user-defined types are referred to as classes. Classes are supported in much the same way as Progress built-in data types and are managed in a similar fashion to Progress 4GL objects (such as procedure, buffer, or query objects). Classes can be used as data types for variables, parameters, and return types. You can store a reference to an object in a temp-table by defining a field as
Progress.Lang.Object, but you cannot store an object reference in a database table. The initial value of an object reference is the Unknown value (?).Like 4GL objects, you must create an instance of a user-defined class before you can reference its methods or data members. Also, when you no longer need the class instance, you must explicitly delete it to prevent memory leaks.
If you instantiate multiple instances of a class, there are multiple instances of the class in the Progress session. However, just as happens with persistent procedures, these multiple instances share r-code in memory with a separate data segment for each instance.
You cannot define an array of classes. The
EXTENTkeyword is not valid when defining a variable, temp-table field, return type, or parameter whose type is a class.You do not reference a class instance using a handle (
HANDLEdata type), as with procedures and other 4GL internal objects. Instead, you use an object reference whose data type is the type name of the class. Thus, you cannot use an object reference in any statement or function that expects aHANDLEdata type.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |